import React, { Component } from 'react';
import { Input } from 'antd';
import Label from '../LabelDecorator';

@Label()
class TextArea extends Component {
  render() {
    const { getData, getStyle, labelWidth = 0 } = this.props;
    const style = getStyle();
    const { fontStyle, ...rest } = style;
    let fontStyleObj = null;
    switch (fontStyle) {
      case 'bold':
        fontStyleObj = { fontWeight: 'bold' };
        break;
      case 'italic':
        fontStyleObj = { fontStyle: 'italic' };
        break;
      case 'underline':
        fontStyleObj = { textDecoration: 'underline' };
        break;
      default:
        break;
    }
    return (
      <Input.TextArea
        style={{ ...rest, ...fontStyleObj, width: `calc(100% - ${labelWidth}px)`, resize: 'none' }}
        placeholder={getData('placeholder')}
      />
    );
  }
}

export default TextArea;
